package com.offcn.entity;

import com.offcn.service.CourseService;

import java.io.File;

public class DeleteCourse {
    public static void deleteCourse(String deleteCourseUid){
        CourseService courseService = new CourseService();
        String[] split = deleteCourseUid.split(",");
        for (String s : split) {
            Course course= courseService.selectFileName(s);
            File fileImage = new File("D:/eduSource/"+course.getCourseImage());
            File fileVideo = new File("D:/eduSource/"+course.getCourseVideo());
            if (fileImage.exists()){
                fileImage.delete();
            }
            if (fileVideo.exists()) {
                fileVideo.delete();
            }
        }
    }
}
